import request from '@/utils/request'

// 管理员列表
export function adminUserList(params) {
  return request({
    url: '/admin',
    method: 'get',
    params
  })
}

// 权限按钮
export function permissionBtn(params) {
    return request({
      url: '/user/permission',
      method: 'post',
      params
    })
  }

// 添加管理员
export function addAdmin(params) {
  return request({
    url: '/admin',
    method: 'post',
    params
  })
}

// 更新管理员
export function updateAdmin(params) {
  return request({
    url: '/admin/' + params.id,
    method: 'put',
    params
  })
}

// 删除管理员
export function deleteAdmin(id) {
  return request({
    url: '/admin/' + id,
    method: 'delete'
  })
}

//菜单列表
export function menuList(params) {
  return request({
    url: '/menus',
    method: 'get',
    params
  })
}


//添加菜单
export function addMenu(params) {
  return request({
    url: '/menus',
    method: 'post',
    params
  })
}

//更新菜单
export function updateMenu(params) {
  return request({
    url: '/menus/'+params.id,
    method: 'put',
    params
  })
}

//删除菜单
export function deleteMenu(id) {
  return request({
    url: '/menus/'+id,
    method: 'delete'
  })
}

//获取菜单
export function serverRouterMap() {
//   return request({
//     url: '/user/menus',
//     method: 'post'
//   })
  return request({
    url: '/user/allMenus',
    method: 'post'
  })
}

//我的未读消息
export function messageCount()
{
  return request({
    url: '/messageCount',
    method: 'post'
  })
}

//我的消息列表
export function messageList()
{
  return request({
    url: '/messageList',
    method: 'post'
  })
}

//设置消息已读
export function messageReadAt(id)
{
  return request({
    url: '/messageReadAt',
    method: 'post',
    params:{
        id:id

    }
  })
}

//设置消息已读
export function messageDelete(id)
{
  return request({
      url: '/messageDelete/'+id,
     method: 'post'
  })
}

